package com.neutech.service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.neutech.mapper.UserMapper;
import com.neutech.po.User;
@Service
public class UserService {
	@Autowired
	private UserMapper userMapper;
	public User getUser(int id){
		try {
			return userMapper.findUserById(id);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return new User();
	}
	public void updateUser(){
		User user = new User();
		user.setUsername("空条承太郎");
		user.setId(17);
		try {
			userMapper.updateUserById(user);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	public void deleteUser(int id){
		try {
			userMapper.deleteUserById(id);
		} catch (Exception e) {
			e.printStackTrace();
		}		
	}
	public void addUser(){
		User user = new User();
		user.setUsername("恩里克·布奇");
		user.setSex("男");
		try {
			userMapper.addUser(user);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}
